package com.xidian.zhiancloud.controller.luling.systemconfiguration;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.WarSignCategoryStatus;
import com.xidian.zhiancloud.service.luling.systemconfiguration.WarSignCategoryStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 ** 警示标志类别接口
 * @Author:luling
 * @Date:2021/1/7   15:24
 */
@RestController
@RequestMapping("/WarSignCategoryStatus")
public class WarSignCategoryStatusController {
    @Autowired
    private WarSignCategoryStatusService  warSignCategoryStatusService;
    /**
     *添加警示标志类别信息
     @param   warSignCategoryStatus 警示标志类别对象
     @return ResultDTO 对象
     */
    @PostMapping("/insert")
    public ResultDTO<Boolean> insert(@RequestBody WarSignCategoryStatus warSignCategoryStatus) {
        warSignCategoryStatusService.insert(warSignCategoryStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     *删除警示标志类别信息
     @param   warSignCategoryStatus 警示标志类别对象
     @return ResultDTO 对象
     */
    @PostMapping("/delete")
    public ResultDTO<Boolean> delete(@RequestBody WarSignCategoryStatus warSignCategoryStatus) {
        warSignCategoryStatusService.delete(warSignCategoryStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     *修改警示标志类别信息
     @param   warSignCategoryStatus 警示标志类别对象
     @return ResultDTO 对象
     */
    @PostMapping("/update")
    public ResultDTO<Boolean> update(@RequestBody WarSignCategoryStatus warSignCategoryStatus) {
        warSignCategoryStatusService.update(warSignCategoryStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 列表查询
     *
     * @param  num 编号
     * @param name 名称
     * @param  personAdd  添加人
     * @param   key    关键字
     * @param current   分页偏移量
     * @param size    每一页的数量
     * @return 返回警示标志类别列表
     **/
    @GetMapping("/getList")
    public ResultDTO<Object> getList(@RequestParam(value = "num", required = false) String num,
                             @RequestParam(value = "name", required = false) String name,
                             @RequestParam(value = "personAdd", required = false) String personAdd,
                             @RequestParam(value = "key", required = false) String key,
                             @RequestParam(value = "current", required = true) int current,
                             @RequestParam(value = "size", required = true) int size) {
        return ResultDTO.successOf(warSignCategoryStatusService.getList(num, name, personAdd,key,current, size), GeneralResponseEnums.SUCCESS);
    }
}


